home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
3_0
/
DOUBLEDE
/
ABOUT.C
next >
Wrap
Text File
|
1988-07-28
|
2KB
|
100 lines
/*====================================================================
about.c
a general About... routine which displays a window giving credit
to the author, version number, and copyright notice.
sample calling procedure...
....
doabout("My Application","Version Number");
====================================================================*/
#include <WindowMgr.h>
#include <EventMgr.h>
#include <TextEdit.h>
#define COPYRIGHT "Copyright ⌐ 1988 by Galen Babcock"
doabout(titleStr,versionStr)
char *titleStr;
char *versionStr;
{
Rect r;
WindowPtr w;
Str255 about_utilStr;
/*
create the About... window
*/
SetRect(&r,0,0,350,120);
SetPort(w=NewWindow(0L,&r,"\p",FALSE,3,-1L,FALSE,0L));
TextFont(0);
TextSize(12);
TextFace(condense);
centerwindow(w,&screenBits.bounds);
ShowWindow(w);
/*
calculate rectangle for application title, and draw the
text using TextBox
*/
r = w->portRect;
r.top += 15;
r.bottom = r.top + 15;
TextBox(titleStr,strlen(titleStr),&r,teJustCenter);
/*
change fonts, offset rect for author credit, and
draw with TextBox
*/
TextFont(3);
TextSize(9);
TextFace(0);
strcpy(about_utilStr,"by Galen Babcock");
OffsetRect(&r,0,15);
TextBox(about_utilStr,strlen(about_utilStr),&r,teJustCenter);
/*
give THINK the required credit
*/
OffsetRect(&r,0,18);
r.bottom = r.top + 60;
strcpy(about_utilStr,"Written & Compiled with LightspeedC 2.15...\r therefore ");
strcat(about_utilStr,"portions Copyright ⌐ 1986,1987 by THINK Technologies, Inc.");
TextBox(about_utilStr,strlen(about_utilStr),&r,teJustCenter);
/*
calculate position of copyright notice (lower left corner),
and draw the C string
*/
r = w->portRect;
MoveTo(r.left+4,r.bottom-4);
DrawText(COPYRIGHT,0,strlen(COPYRIGHT));
/*
take version number passed in parameter, add "Version "
to front of it, calculate the position to draw it
(lower right corner) and draw the C string
*/
strcpy(about_utilStr,"Version ");
strcat(about_utilStr,versionStr);
MoveTo(r.right-4-TextWidth(about_utilStr,0,strlen(about_utilStr)),r.bottom-4);
DrawText(about_utilStr,0,strlen(about_utilStr));
/*
wait for a mouse click....
*/
while(Button());
while(!Button());
while(Button());
FlushEvents(mDownMask,0);
/*
dispose everything and return
*/
HideWindow(w);
DisposeWindow(w);
}